package tags;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.PageContext;


public class IfTag
implements Tag
{
	private String test;
	private String str;
	private String equals;

	
	public void setPageContext(PageContext pc)
	{
		//System.out.println("IfTag.setPageContext()");
	
	}
	
	public void setParent(Tag t) 
	{
		//System.out.println("IfTag.setParent()");
		
	}
	
	public void setTest(String s) 
	{
		//System.out.println("IfTag.setTest(" + s + ")");
		test = s;
	}
	
	public void setStr(String s)
	{
		//System.out.println("IfTag.setString(" + s + ")");
		str = s;
	}
	
	public void setEquals(String s)
	{
		//System.out.println("IfTag.setEquals(" + s + ")");
		equals = s;
	}
	
	public int doStartTag() throws JspException 
	{ 
		//System.out.println("IfTag.doStartTag()");
		if(test != null)
			return Boolean.valueOf(test).booleanValue() ? EVAL_BODY_INCLUDE : SKIP_BODY;
		else if(str != null && equals != null)
			return str.equals( equals ) ? EVAL_BODY_INCLUDE : SKIP_BODY;
		return SKIP_BODY;
	}
	
	public int doEndTag() throws JspException
	{ 
		//System.out.println("IfTag.doEndTag()");
		return EVAL_PAGE; 
	}

	public Tag getParent()
	{
		
		return null;
	}

	public void release()
	{
		
		
	} 
}

